package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.MyActivityRecordListResponse;

public class MyActivityRecordListRequest extends HttpCacheRequest<MyActivityRecordListResponse> {

    public final String ACTIVITY_ID = "activityId";
    public final String ACTIVITY_NAME = "activityName";
    public final String ACTIVITY_TYPE = "activityType";
    public final String USER_TYPE = "userType";
    public final String JOIN_RESULT = "joinResult";
    public final String BEGIN_DATE = "beginDate";
    public final String END_DATE = "endDate";
    public final String PAGE_NUMBER = "pageNumber";
    public final String PAGE_SIZE = "pageSize";
    public final String ORDER_NAME = "orderName";
    public final String ORDER_TYPE = "orderType";
    
    public MyActivityRecordListRequest(String userId) {
        super(Constants.ADDRESS, Constants.myActivityRecordList);
        addParam("userId", userId);
        addParam("chshToken", Constants.TOKEN);
    }

    /**
     * <可选参数> 
     * <param name="activityId">活动ID</param> 
     * <paramname="activityName">活动名称</param> 
     * <param name="activityType">活动类型</param>
     * <param name="userType">平台类型</param> 
     * <param name="joinResult">结果</param>
     * <param name="beginDate">开始时间</param> 
     * <param name="endDate">结束时间</param>
     * <param name="pageNumber">当前页码</param> 
     * <param name="pageSize">每页数量</param>
     * <param name="orderName">排序字段</param> 
     * <param name="orderType">0.升序，1.降序</param> 
     * </可选参数>
     */
    public MyActivityRecordListRequest add(String key, String value) {
        addParam(key, value);
        return this;
    }

    public MyActivityRecordListRequest encryption() {
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }

    @Override
    protected MyActivityRecordListResponse parseJson(String response) throws Exception {
        MyActivityRecordListResponse r = new MyActivityRecordListResponse();
        r.parseJson(response);
        return r;
    }

}
